<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script>
$(function(){
	$('#scrollContent').height(310);
    if ( '${item}' == '') return;
	$('#rzfl').val('${item.rzfl}');
	$('#qfd').val('${item.qfd}');
	$('#stlx').val('${item.stlx}');
	$('#nd').val('${item.nd}'); 
})


function choose() {
	
	var diag = new top.Dialog();
	diag.Title = "知识点选择";
	diag.Width = 600;
	diag.Height = 400;
	diag.CancelEvent = function(){
		diag.close();
	};
	
	 diag.OKEvent = function(){
		 
		var b = $(':checked',diag.innerFrame.contentWindow.document);
		var id = '';
		var name ='';
		b.each(function(){
			id = id + ',' + $(this).val() ; 
			name = name + ',' + $(this).parent().text();
		});	
		$('#knowname').val(name.substring(1));	
		$('#knowid').val(id.substring(1));	 
		diag.close();
	}; 

	diag.URL = "edus.know.query_Know.psp";
	diag.show();
	
}


function query(){
	$('#page').val('0');
}
</script>
</head>
<body>

	<div class="box2" panelTitle="查询条件">

	  <form action="edus.item.query_Item.psp" method="post" id="form" target="_self">
	  
	  <input type="hidden" name="limit" id="limit" value="${limit}"/>
	  <input type="hidden" name="page" id="page" value="${page}"/>
	  <input type="hidden" name="item.knowid" id="knowid" value="${item.knowid }"/>
	  <input type="hidden" id="itemid1" name="item.id" value="${item.id }"/>
	  
		<table class="tableStyle"  formMode="true">
			<tr>
				<td>知识点：
	
	</td>
				<td><div style="float:left;width:130px;">
				<input type="text" id="knowname" name="knowname" value="${knowname }"/> </div>
				   <div style="width:10px;float:left">
					<span onclick="choose();" style="postion:absolute;left:40px;" class="icon_find">&nbsp;</span>
					</div>
				</td>
				<td>试题类型：</td>
				<td><select id="stlx" name="item.stlx" class="sel" value="${item.stlx }">
				    <option value="">--请选择--</option>
					<option value="1">单择题</option>
					<option value="2">多选题</option>
					<option value="3">判断题</option>
					<option value="4">填空题</option>
					<option value="5">简答题</option>
					<option value="6">论述题</option>
					</select></td>
					<td>难度：</td>
				<td><select id="nd" name="item.nd" class="sel" value="${item.stlx }">
				<option value="">--请选择--</option>
					<option value="1">容易</option>
					<option value="2">易</option>
					<option value="3">中等</option>
					<option value="4">难</option>
					<option value="5">很难</option>
					</select></td>
				
			</tr>
			<td>区分度：</td>
				<td><select name="item.qfd" id="qfd" class="sel" value="${item.qfd }">
				<option value="">--请选择--</option>
					<option value="1">高</option>
					<option value="2">较高</option>
					<option value="3">中等</option>
					<option value="4">较低</option>
					<option value="5">低</option>
					</select></td>
					 <td>认知分类 ：</td>
				<td><select id="rzfl" name="item.rzfl"  class="sel" value="${item.rzfl }">
				<option value="">--请选择--</option>
					<option value="1">理解</option>
					<option value="2">熟悉</option>
					<option value="3">掌握</option>
					<option value="4">应用</option>
					</select></td>
				<td>出题时间 ：</td>
				<td><input name="item.date" id="name" class="date" value="${item.date }"/></td>
			<tr>
			</tr>
			<tr>		
				<td>出题人 ：</td>
				<td><input name="item.author"  id="author"  value="${item.author}"/>
					</td>
			    <td></td><td></td>
			    <td></td><td></td>
			</tr>
			<tr>
			<td colspan="8"><input type="submit" value="查询" onclick="query()"></input></td>
				
			</tr>
		</table>
	  </form>
	</div>		
		
	<div class="box2" id="result"  panelTitle="查询结果" >

	<div id="scrollContent" class="border_gray" style="padding-right:1px;">
	
<table class="tableStyle" useCheckBox="true" >
<c:if test="${flag == 1}">
		<tr>
		<th></th>
			<th width="10%">试题id</th>
			<th width="20%">内容</th>
			<th width="20%">选项</th>
			<th width="10%">分数</th>
			<th width="10%">难度</th>
			<th width="10%">认知分类</th>
			<th width="10%">区分度</th>
			<th width="10%">出题日期</th>
		</tr>
		<c:forEach var="item" items="${items }"  varStatus="s">
		<tr>
		   <td><input type="checkbox" value="${item.id }"/></td>
		   <td>${item.id }</td>
		    <td> <span class="text_slice" style="width:300px;" title="${item.content}"> ${item.content }</span></td>
		    <td><span class="text_slice" style="width:300px;" title="${item.options}">${item.options }</span></td>
		    <td>${item.score }</td>
		    <td>
		    <script>
		    var nd =   '${item.nd }';
		    var ndArray = ['容易','易','中等','难','很难'];
		    document.write(ndArray[nd - 1]);
		    </script>
		   
		    </td>
		    <td><script>
		   			 var rzfl =   '${item.rzfl }';
		   			 var rzflArray = ['理解','熟悉','掌握','应用'];
		    		 document.write(rzflArray[rzfl - 1]);
		            </script></td>
		    <td><script>
		   			 var qfd =   '${item.qfd }';
		   			 var qfdArray = ['高','较高','中等','较低','难'];
		    		 document.write(qfdArray[qfd -1]);
		            </script></td>
		         <td>${item.date}</td>
		   </tr>
		</c:forEach>
		</c:if>
	</table>
	
	</div>
	<div style="padding-right:2em;margin-top:2px;">
	<span style="float:left"><button onclick="onAdd();">增加</button>
	<button onclick="onUpdate();">修改</button>
	<button onclick="onView();">查看</button>
	<button onclick="onDelete()">删除</button></span>
	<span  style="float:right">总计 ${count}条记录，${pages }页 
	<button   onclick="firstPage();">首页</button><button id="pre" onclick="prePage();">上页</button>
	<button id="next" onclick="nextPage();">下页</button><button onclick="tailPage();">尾页</button>
	第<input type="text"  id="curPage" value="${page}"style="width:20px;"/>页</span></div>
	</div>		
	<form action="edus.item.updatePre_Item.psp" id="updateForm"> 
		<input type="hidden" id="itemid" name="item.id"/>
	</form>
</body>
</html>
<script>


function onUpdate(){
	var selcd = $('#result :checked');
	if ( selcd.length != 1){
		alert("请选择一条记录进行修改");
		return
	}
	
	$('#itemid').val(selcd.val());
	$('#updateForm').submit();
	return ;
}

function onView(){
	var selcd = $('#result :checked');
	if ( selcd.length != 1){
		alert("请选择一条记录进行查看");
		return
	}
	
	$('#itemid').val(selcd.val());
	$('#updateForm')[0].action = "edus.item.view_Item.psp";
	$('#updateForm').submit();
	return ;
}
 
function onDelete(){
	var selcd = $('#result :checked');
	if ( selcd.length == 0){
		alert("请至少选择一条记录进行删除");
		return
	}
	
	var selid = '';
	selcd.each(function(){
		selid = selid + ","+ this.value ;
	})
	selid.substring(1);
	
	$('#itemid1').val(selid);
	$('#form')[0].action = "edus.item.delete_Item.psp";
	$('#form').submit();
	return ;
} 

function onAdd(){
	$('#updateForm')[0].action = "edus.item.add_Item.jsp.psp"; 
	$('#updateForm').submit();
	return ;
}

$(function() {
	var page = $('#page').val();
	if ( page == '0') {
		$('#pre').attr('disabled','true');
	}
	
	if ( page == '${pages - 1}'){
		$('#next').attr('disabled','true');
	}
})


function firstPage(){
	$('#page').val('0');
	$('#form').submit();
}

function prePage() {
	var page = $('#page');
	page.val(parseInt( page.val() ) - 1);
	$('#form').submit();
	
}

function nextPage() {
	
    var page = $('#page');
	var value =  parseInt(page.val()) + 1;
	page.val(value);
	$('#form').submit();
}

function tailPage() {
   $('#page').val('${pages-1}');	
   $('#form').submit();
}
/**/
</script> 